import { InitData } from '@/components/common/typing/table'
import router from '@/router'
import { store } from '@/store'
interface PathData {
  path:string
  params?: InitData
  query?: InitData
}
/**
 * type?:string 用什么方式 push、replace、go
 * isKeepAlive?:boolean 是否用KeepAlive
 */
interface Config {
  type?:string
  isKeepAlive?:boolean
}
export const routerTo = (pathData:PathData, config?:Config) => {
  store.commit('setKeepAlive', config?.isKeepAlive)
  setTimeout(() => {
    router[config?.type || 'push'](pathData)
  }, 20)
}
